import request from '@/utils/axios-req'
const SERVERURL = import.meta.env.VITE_APP_BASE_MIAN_URL
// const SERVERURL = 'http://localhost:8000'

// ### 获取管理员个人信息
export const uploadFile = (formdata) => {
    return request({
      url: `${SERVERURL}/upload/multi`,
      reqLoading: false,
      method: 'post',
      data: formdata
    })
}
// ### 获取管理员个人信息
export const getUploadList = ({ page, size }) => {
    return request({
      url: `${SERVERURL}/upload/list?skip=${page}&limit=${size}`,
      reqLoading: false,
      method: 'get'
    })
}
// ### 获取管理员个人信息
export const getUploadFileDetail = (id) => {
    return request({
      url: `${SERVERURL}/upload/list/${id}`,
      reqLoading: false,
      method: 'get'
    })
}
// ### 下载指定已上传的文件
export const dowloadUploadFile = (id) => {
    return request({
      url: `${SERVERURL}/upload/list/${id}/download/`,
      reqLoading: false,
      method: 'get'
    })
}
// ### 上传多文件
// POST http://localhost:8000/upload/multi HTTP/1.1
// Content-Type: multipart/form-data; boundary=boundary123
// Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJqYXkzMjIyMSIsImV4cCI6MTcxNTE3NjA5N30.d1ZwLGqAHLgbxxktiWN8vFhOUSRFQV3FK-4uuWBEfpY 

// --boundary123
// Content-Disposition: form-data; name="files"; filename="up_model.ply"
// Content-Type: application/octet-stream

// < stl_data/up_model.ply

// --boundary123
// Content-Disposition: form-data; name="files"; filename="down_model.stl"
// Content-Type: application/octet-stream

// < stl_data/down_model.stl

// --boundary123--


// ### 已经上传的所有文件列表
// GET http://localhost:8000/upload/list HTTP/1.1
// Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJqYXkzMjIyMSIsImV4cCI6MTcxNTE3NjA5N30.d1ZwLGqAHLgbxxktiWN8vFhOUSRFQV3FK-4uuWBEfpY

// ### 根据上传文件ID获取文件详情
// GET http://localhost:8000/upload/list/1 HTTP/1.1
// Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJqYXkzMjIyMSIsImV4cCI6MTcxNTE3NjA5N30.d1ZwLGqAHLgbxxktiWN8vFhOUSRFQV3FK-4uuWBEfpY

// ### 下载指定已上传的文件
// GET http://localhost:8000/upload/list/1/download/ HTTP/1.1
// Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJqYXkzMjIyMSIsImV4cCI6MTcxNTE3NjA5N30.d1ZwLGqAHLgbxxktiWN8vFhOUSRFQV3FK-4uuWBEfpY

